/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 *
 * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
 *
 * Contributor(s): 
 *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
 *  
 * If you didn't download this code from the following link, you should check
 * if you aren't using an obsolete version: http://www.isqlviewer.com
 */
package org.isqlviewer;

import javax.swing.UIManager;

import org.isqlviewer.util.StringUtilities;

/**
 * TODO Add PreferenceKeys Overview JavaDoc.
 * <p>
 * 
 * @author Mark A. Kobold &lt;mkobold at isqlviewer dot com&gt;
 * @version 1.0
 */
public final class UserOptions {

    public static String createStyleKey(String base, String secondary) {

        return base.concat(".").concat(secondary);
    }

    public static final String KEY_STYLE_ITALICS = "italics";

    public static final String KEY_STYLE_COLOR = "color";

    public static final String KEY_STYLE_BOLDED = "bolded";

    /**
     * Boolean property to determine if it should automatically check for a new version of iSQL-Viewer on startup.
     */
    public static final String KEY_USE_WEB_CHK = "advanced.versioncheck-enabled";
    /**
     * Integer property that determine if Beta &amp; Stable version are acceptable or just Stable versions.
     */
    public static final String KEY_WEB_CHK_TYPE = "advanced.versioncheck-type";
    /**
     * String property that is the name of a iSQL service to automatically connect on startup.
     */
    public static final String STARTUP_SERVICE = "jdbc.auto-service";
    /**
     * Boolean property for configuring JDBC tracing when connected to an iSQL service.
     */
    public static final String KEY_JDBC_TRACE_ENABLED = "jdbc.trace-enabled";
    /**
     * Boolean property that ensures a final commit is called to a service if nessecary, upon disconnection.
     */
    public static final String KEY_JDBC_COMMIT_ON_CLOSE = "jdbc.autocommit-enabled";
    /**
     * Boolean property to determine if JDBC activity is verbose or not.
     */
    public static final String KEY_JDBC_VERBOSE = "jdbc.verbose-enabled";
    /**
     * Boolean property to echo or not echo queries as they are executed.
     */
    public static final String KEY_QUERY_ECHO = "jdbc.echo-query";
    /**
     * Boolean property to ensure that when queries are executed that the connection is available.
     */
    public static final String KEY_JDBC_KEEPALIVE = "jdbc.keepalive-enabled";
    /**
     * Boolean property to tell database connection that you want genereated keys if available from ResultSets.
     */
    public static final String KEY_JDBC_GENERATE_KEYS = "jdbc.resultsetkeys-enabled";
    /**
     * Integer property for the number of seconds that should pass before a connection timesout.
     */
    public static final String KEY_LOGIN_TIMEOUT = "jdbc.timeout-login";
    /**
     * Integer property for the number of seconds that should pass before a statement execution timesout.
     */
    public static final String KEY_QUERY_TIMEOUT = "jdbc.timeout-query";
    /**
     * Boolean property to echo the number of rows recieved from a ResultSet object.
     */
    public static final String KEY_ROW_CNT_ECHO = "jdbc.echo-rowcount";
    /**
     * Integer property for configuring resultset holdability.
     * 
     * @see java.sql.Connection#setHoldability(int)
     */
    public static final String KEY_JDBC_HOLDABILITY = "jdbc.resultset-holdability";
    /**
     * Boolean property to turn on/off escaping processing in the JDBC driver.
     */
    public static final String KEY_JDBC_ESCAPE = "jdbc.escapeProc-enabled";
    /**
     * Boolean property to debug JDBC activity.
     */
    public static final String KEY_JDBC_DEBUG = "jdbc.debug-enabled";
    /**
     * Boolean property for enabling reverse fetching of ResultSet data.
     */
    public static final String KEY_JDBC_RFETCH = "jdbc.reverseFetch-enabled";
    /**
     * Integer property to configure the maximum number of rows a Statement object should return.
     */
    public static final String KEY_JDBC_MAX_ROWS = "jdbc.max-rows";
    /**
     * Integer property to configure the maximum field size a Statement object should return.
     */
    public static final String KEY_JDBC_MAX_FIELD_SZ = "jdbc.max-fieldsize";
    /**
     * Integer property to determine how deep to process chained SQLExceptions &amp; SQLWarnings.
     */
    public static final String KEY_WARNING_CHAIN_LENGTH = "jdbc.max-warnings";
    /**
     * Boolean property that determines if the resultset toolbar is enabled or not.
     */
    public static final String KEY_TB_RESSET_VISIBLE = "toolbar.resultset-visible";
    /**
     * Boolean property that determines if the main toolbar is enabled or not.
     */
    public static final String KEY_TB_FILE_VISIBLE = "toolbar.file-visible";
    /**
     * Boolean property that determines if the SQL editor toolbar is enabled or not.
     */
    public static final String KEY_TB_HISTORY_VISIBLE = "toolbar.history-visible";
    /**
     * String property that determines the location of the resultset toolbar e.g. NORTH,SOUTH,EAST,WEST
     */
    public static final String KEY_TB_RESSET_DOCK = "toolbar.resultset-dock";
    /**
     * String property that determines the location of the main toolbar e.g. NORTH,SOUTH,EAST,WEST
     */
    public static final String KEY_TB_FILE_DOCK = "toolbar.file-dock";
    /**
     * String property that determines the location of the SQL Editor toolbar e.g. NORTH,SOUTH,EAST,WEST
     */
    public static final String KEY_TB_HISTORY_DOCK = "toolbar.history-dock";
    /**
     * Boolean property for wether all classes are shown in the service manager or only those in the classpath.
     */
    public static final String KEY_SERVICE_DRIVERS_VISIBLE = "general.alldrivers-visible";
    /**
     * Boolean property for switching tabs when a new service is selected in the service manager.
     */
    public static final String KEY_SERVICE_SWITCH_ON_CHANGE = "servicemanager.switchtab-enabled";
    /**
     * Boolean property to ensure that the JDBC driver listing is always sorted or not.
     */
    public static final String KEY_DRIVERS_AUTOSORT = "general.driversort-enabled";
    /**
     * Boolean property that allows the current driver.properties file to overwritten when a new version is installed.
     */
    public static final String KEY_DRIVERS_AUTOUPDATE = "general.driverupdate-enabled";
    /**
     * Boolean property to scan service paths for service files when iSQL-Viewer is started.
     */
    public static final String KEY_SERVICE_AUTODETECT = "general.servicescan-enabled";
    /**
     * String property of the fully qualified class name of the desired LookAndFeel to use.
     */
    public static final String KEY_LOOK_N_FEEL = "general.plaf-class";
    /**
     * Boolean property for using large 24x24 or smaller 16x16 icons.
     */
    public static final String KEY_USE_LARGE_ICONS = "general.large-icons";
    /**
     * Boolean property that enables a single click sort of tables otherwise a double-click is required.
     */
    public static final String SINGLE_CLICK_SORTING = "general.1clicksort-enabled";
    /**
     * String property that is the format for the tabs of ResultSets so that they can be easily identified.
     */
    public static final String KEY_RESSET_TAB_FMT = "general.results-format";
    /**
     * Boolean property for saving session oriented information such as last selection, and window locations.
     */
    public static final String KEY_ENABLE_METRICS = "general.metrics-enabled";
    /**
     * String property that is a localized path of directories and files to load classes from.
     */
    public static final String KEY_EXTRA_CLASSPATH = "advanced.classpath";
    /**
     * String property that is a localized path of directories to load iSQL services.
     */
    public static final String KEY_SERVICES_PATH = "advanced.servicepath";
    /**
     * Color property to that is used to highlight null values returned from ResultSet objects.
     */
    public static final String KEY_NULL_HIGHLIGHT = "general.null-color";
    /**
     * Boolean property that will reuse that same tab when refreshing a previously executed statement.
     */
    public static final String REUSE_TAB_ON_REFRESH = "general.refresh-reuse";
    /**
     * Boolean property that will clear the SQL Editor upon execution of an SQL statement.
     */
    public static final String KEY_EDITOR_AUTO_CLEAR = "editor.autoclear-enabled";

    /**
     * Boolean for enabling/disabling context-sensitive help in the main editor.
     */
    public static final String EDITOR_CONTEXT_HELP = "editor.context-help.enabled";
    /**
     * Boolean for enabling/disabling syntax highlighting in the main editor.
     */
    public static final String EDITOR_SYNTAX_HELP = "editor.syntax-help.enabled";
    /**
     * Boolean property to determine if the caret style is row:column or :location.
     */
    public static final String KEY_EDITOR_CARET_STYLE = "editor.caretoffset-enabled";
    /**
     * Color property for the SQL editor's foreground.
     */
    public static final String STYLE_BASE_COLOR = "editor.default-color";
    /**
     * Color property for the SQL editor's background.
     */
    public static final String EDITOR_DEFAULT_COLOR = "editor.background-color";
    /**
     * Color property for syntax highlighting of table,views, and procedure names along other JDBC objects.
     */
    public static final String STYLE_LOCAL_OBJ = "editor.local-obj";
    /**
     * Color property for syntax highlighting of SQL keywords.
     */
    public static final String STYLE_SQL_KEWORDS = "editor.sql-keywords";
    /**
     * Color property for syntax highlighting single line comments.
     */
    public static final String STYLE_SLINE_CMNTS = "editor.sline-comments";
    /**
     * Color property for syntax highlighting of string literals.
     */
    public static final String STYLE_LITERALS = "editor.literals";
    /**
     * Color property for syntax highlighting of sql functions.
     */
    public static final String STYLE_FUNCTIONS = "editor.functions";
    /**
     * Color property for syntax highlighting of sql &amp; parameters.
     */
    public static final String STYLE_PARAMETERS = "editor.parameters";
    /**
     * Style preference for tablespace words like catalogs, and schema names.
     */
    public static final String STYLE_TABLESPACE = "editor.tablespace";

    public static final String STYLE_PROCEDURES = "editor.procedures";
    public static final String STYLE_FOREIGN_OBJ = "editor.foreign-obj";
    /**
     * Font property for the SQL editor.
     */
    public static final String KEY_EDITOR_FONT = "editor.font";
    /**
     * Color property for syntax highlighting of multi-line commets such as /** comments
     */
    public static final String STYLE_MLINE_CMNTS = "editor.multicomment-color";
    /**
     * Color property for the Syste console foreground color.
     */
    public static final String KEY_CONSOLE_FG_COLOR = "console.foreground-color";
    /**
     * Default color for the console foreground.
     */
    public static final String DEF_CONSOLE_FG_COLOR = StringUtilities.getHTMLColor(UIManager
            .getColor("TextArea.foreground"));

    /**
     * Color property for the System console background color.
     */
    public static final String KEY_CONSOLE_BG_COLOR = "console.background-color";
    /**
     * Default color for the console background.
     */
    public static final String DEF_CONSOLE_BG_COLOR = StringUtilities.getHTMLColor(UIManager
            .getColor("TextArea.background"));

    /**
     * Color property of text that is printed using the System.out PrintStream.
     */
    public static final String KEY_CONSOLE_SYS_COLOR = "console.sys-color";
    /**
     * Color property of text that is printed using the System.err PrintStream.
     */
    public static final String KEY_CONSOLE_ERR_COLOR = "console.err-color";
    /**
     * Default HTML color for displaying errors in the iSQL-Viewer console.
     */
    public static final String DEF_CONSOLE_ERR_COLOR = "#FF0000";

    /**
     * Color property for displaying text printed using the JDBC tracing streams.
     */
    public static final String KEY_CONSOLE_SQL_COLOR = "console.sql-color";
    /**
     * Font property for the iSQL console component.
     */
    public static final String KEY_CONSOLE_FONT = "console.font";
    /**
     * Default font property to use if none is previously set.
     */
    public static final String DEF_CONSOLE_FONT = "Monospaced,11";

    public static final String DEF_CONSOLE_SQL_COLOR = "#0000FF";

    /**
     * String property that is the format of time in which to prepend to text being displayed.
     */
    public static final String KEY_CONSOLE_TIME_FMT = "console/timestamp-format";
    /**
     * Default time format if no preference is previously set.
     */
    public static final String DEF_CONSOLE_TIME_FMT = "[HH:mm:ss]";

    /**
     * Integer property that determines which kind of history set to use.
     */
    public static final String KEY_HISTORY_STYLE = "history.style";
    /**
     * Integer property for the maximum number of days to keep a history item.
     */
    public static final String KEY_HISTORY_MAX_DAYS = "history.max-days";
    /**
     * Integer property for the maximum number of history items to manage at a time.
     */
    public static final String KEY_HISTORY_MAX_COUNT = "history.max-count";
    /**
     * Boolean property for browsing history items to be circular or not.
     */
    public static final String KEY_HISTORY_CONTINUOUS = "history.circular-enabled";
    /**
     * Boolean property that will discard duplicate history items.
     */
    public static final String KEY_HISTORY_DISCARD_DUPES = "history.duplicates-enabled";
    /**
     * Boolean property for enabling/disabling the use of CRC32 when detecting duplicate history items.
     */
    public static final String KEY_HISTORY_USECRC32 = "history.crc32-enabled";
    /**
     * Boolean property to determine if the history items of the current session are kept when manually cleared.
     */
    public static final String KEY_HISTORY_CLEAR_SESSION = "history.sessionclear-enabled";
    /**
     * Boolean property that enables a history that is not persisted to disk.
     */
    public static final String KEY_HISTORY_SESSION_ONLY = "history.persistent-enabled";
    /**
     * Boolean property that enabled the showing of hidden files when selecting a file or directory.
     */
    public static final String KEY_SHOW_HIDDEN_FILES = "general.hiddenfiles-enabled";
    /**
     * Integer property that sets the maximum number of ResultSets before unlocked tabs are reused.
     */
    public static final String MAX_QUERY_VIEWS = "general.max-resultsets";
    /**
     * Integer property of how tables are spread out across mutliple pages.
     */
    public static final String KEY_PRINT_GRID_STYLE = "print.table-style";
    /**
     * Boolean property to use color over monochrome when printing.
     */
    public static final String KEY_PRINT_USE_COLOR = "print.color-enabled";
    /**
     * Boolean property to include the table gridlines when printing.
     */
    public static final String KEY_PRINT_GRID = "print.grid-enabled";
    /**
     * Boolean property to include footer information on each page when printing.
     */
    public static final String KEY_PRINT_FOOTER = "print.footer-enabled";
    /**
     * Boolean property to include header information on each page when printing.
     */
    public static final String KEY_PRINT_HEADER = "print.header-enabled";
    /**
     * Boolean property that indicates the global preference of keeping iSQL service passwords secure.
     */
    public static final String KEY_ENABLE_SECURITY = "general.security-enabled";
    /**
     * String property that is used to seperate SQL statements when parsing batch files.
     */
    public static final String KEY_BATCH_SEPERATOR = "batch.seperator-char";
    /**
     * String property that is used to ignore data based on this value.
     */
    public static final String KEY_BATCH_COMMENT = "batch.comment-char";
    /**
     * String property used to identify string literals when parsing batch files.
     */
    public static final String KEY_BATCH_LITERAL = "batch.literal-char";
    /**
     * Integer property that indicates how statements are seperated in batch files.
     */
    public static final String KEY_BATCH_SEPERATOR_STYLE = "batch.seperator-style";
    /**
     * Integer property for the kind of comments to support when parsing batch files.
     */
    public static final String KEY_BATCH_COMMENT_STYLE = "batch.comment-style";
    /**
     * Integer property for the kind of literal style to used for parsing batch files.
     */
    public static final String KEY_BATCH_LITERAL_STYLE = "batch.literal-style";
    /**
     * Boolean property that will force all text into lower case form when parsing batch files.
     */
    public static final String KEY_BATCH_FORCE_LC = "batch.lowercase-enable";
    /**
     * Integer property to determine the page size of larger tables so that they can render faster.
     */
    public static final String TABLE_PAGING_SIZE = "general.tablepage-size";
    /**
     * String property for the preferred input/output format of Time values.
     */
    public static final String KEY_FORMAT_TIME = "general.time-format";
    /**
     * String property for the preferred input/output format of Timestamp values
     */
    public static final String KEY_FORMAT_TIMESTAMP = "general.timestamp-format";
    /**
     * String property for the preferred input/output format of Date values.
     */
    public static final String KEY_FORMAT_DATE = "general.date-format";
    /**
     * Boolean property to allow the double-click execution of SQL bookmarks.
     */
    public static final String KEY_BOOKMARK_ACTIVATE_STYLE = "bookmark.activation-style";
    /**
     * String property that is the preferred location of the bookmark drawer, ie Right, Left.
     */
    public static final String KEY_BOOKMARK_LOCATION = "bookmark.location";
    /**
     * Boolean property that determines wether to warn the user before deleting bookmarks, and folders.
     */
    public static final String KEY_BOOKMARK_DELETE_WARNING = "bookmarks.deletewarning-enabled";
    /**
     * Boolean property to enable debugging withing the ScriptManager.
     */
    public static final String KEY_SCRIPT_DEBUG = "scripting.debug-enabled";
    /**
     * String property of a localized path of directories to load scripts from.
     */
    public static final String KEY_SCRIPT_PATHS = "scripting.path";
    /**
     * Boolean property to filter out files that are not known to the script manager.
     */
    public static final String KEY_SCRIPT_FILTER_FILES = "scripting.filefilter-enabled";
    /**
     * String property for the preferred HTTP proxy host.
     */
    public static final String KEY_HTTP_PROXY_HOST = "advanced.httpproxy-host";
    /**
     * Integer property for the HTTP proxy port of use on the proxy host.
     */
    public static final String KEY_HTTP_PROXY_PORT = "advanced.httpproxy-port";
    /**
     * String property of the HTTP proxy user name to use.
     */
    public static final String KEY_HTTP_PROXY_USER = "advanced.httpproxy-user";
    /**
     * String property for the HTTP proxy password to use.
     */
    public static final String KEY_HTTP_PROXY_PASSW = "advanced.httpproxy-pass";
    /**
     * This value will indicate the prefix of session proeprties so it is easy to filter them out when preferences are
     * saved to disk.
     */
    public static final String KEY_SESSION_PREFIX = "session.";
    /**
     * String value that is that last accessed file used.
     */
    public static final String KEY_SES_LAST_FILE = "session.last-location";
    /**
     * Boolean property to enable ASCII compatibility for UNICODE characters whenever nessecary.
     * <p>
     * Generally if this preference is true, there will be automatic encoding and decoding of ASCII UNICODE escape
     * sequences of the form '\ uXXXX' where XXXX is the UNICODE value.
     */
    public static final String KEY_USE_ASCII_COMPATIBILITY = "general.ascii2native-enabled";
    /**
     * Boolean property to show statement that return an update count as a tab.
     * <p>
     * When a query is executed in the main SQLWOrkbench, this is true a tab will be created showing the updated count,
     * and will have to be removed manually. otherwise if this is false the update count will be echoed to the
     * System.out which ends up in the console window.
     */
    public static final String KEEP_UPDATE_RESULTS = "general.showupdatetab-enabled";

    private UserOptions() {

        // nothing to do here.//
    }

}
